
package org.jebert.javamessage.control;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.logging.Level;
import java.util.logging.Logger;

public class ContactMulticast extends Thread {

    String contactName;

    public ContactMulticast(String name) {
        this.contactName = name;
    }

    public void run() {

        try {
            DatagramSocket socket = new DatagramSocket(7000);
            DatagramPacket dato = new DatagramPacket(contactName.getBytes(), contactName.getBytes().length, InetAddress.getByName("235.1.1.1"), 7007);
            while (true) {
                socket.send(dato);
                Thread.sleep(1000);
            }
        } catch (Exception ex) {
            Logger.getLogger(ContactMulticast.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
}
